<template>
	<view style="" class="content">
		<view v-if="type == 'note'" style="width: 100%;padding: 25rpx;font-size: 34rpx;font-weight: bold;color: #191919;">
			设置个人签名
		</view>
		<view v-if="type == 'note'" style="width: 100%;padding: 25rpx;padding-top: 0rpx;">
			<u-input focus v-model="user.note" style="padding: 10rpx;" type="textarea" border></u-input>
		</view>
		<view v-if="type == 'name'" style="width: 100%;padding: 25rpx;font-size: 34rpx;font-weight: bold;color: #191919;">
			设置昵称
		</view>
		<view v-if="type == 'name'" style="width: 100%;padding: 25rpx;padding-top: 0rpx;">
			<u-input focus v-model="user.name" style="padding: 10rpx;" border></u-input>
		</view>
		
		<view style="width: 46%;padding: 25rpx;padding-top: 0rpx;margin-top: 160rpx;">
			<u-button @click="saveuser" type="primary">确定</u-button>
		</view>

	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex';
	import {
		sub
	} from '../../common/event';
	export default {
		data() {
			return {
				id: '',
				user: {},
				form: {},
			}
		},
		onLoad({
			type
		}) {
			this.type = type
			this.user = this.$store.state.user.user
		},
		computed: {
			...mapState({
				
			})
		},
		methods: {
			getdata: async function(id) {
				const ret = await this.$u.get(`bgyx/bgyx/getdata/chatgroup/${id}`)
				if (ret && ret.success) {
					this.form = ret.data
				}

			},
			entertypechange: function(e) {
				console.log(e)
				const entertype = this.entertypelist[e].text
				this.form.entertype = entertype
			},
			statuschange: function(e) {
				console.log(e)
				const status = this.statuslist[e].text
				this.form.status = status
			},
			saveuser: async function() {
				const ret = await this.$u.put(`bgyx/bgyx/putdata/user`,this.user)
				if(ret && ret.success){
					uni.showToast({
						title:"修改成功",
					})
					this.$store.commit(`user/setUserData`,this.user)
				}
				uni.navigateBack()
			},
		}
	}
</script>

<style scoped>
	.content {
		width: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
		background: #F3F3F3;
		height: 100vh;
		overflow-y: auto;
		padding: 10rpx;
	}
</style>